Replace Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Changes the value associated with a given key. If the dictionary does not contain a key equal to the passed key, then an ArgumentException is thrown.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public void Replace(
	TKey key,
	TValue value
)
Visual Basic (Declaration)
Public Sub Replace ( _
	key As TKey, _
	value As TValue _
)
Visual C++
public:
void Replace (
	TKey key, 
	TValue value
)

Parameters

key
TKey
The new key.
value
TValue
The new value to associated with that key.

Remarks

Unlike adding or removing an element, changing the value associated with a key can be performed while an enumeration (foreach) on the the dictionary is in progress.

Equality between keys is determined by the comparison instance or delegate used to create the dictionary.

Replace takes time O(log N), where N is the number of entries in the dictionary.

Exceptions

ExceptionCondition
System.Collections.Generic..::KeyNotFoundExceptionkey is not present in the dictionary

See Also